package com.guoyu.gserv.dao.hibernate;

import java.util.List;

import org.hibernate.Session;
import org.hibernate.SessionFactory;

import com.guoyu.gserv.dao.FeedbackDao;
import com.guoyu.gserv.entity.Feedback;

public class FeedbackImpi implements FeedbackDao {
	private SessionFactory sessionFactory;
	public SessionFactory getSessionFactory() {
		return sessionFactory;
	}

	public void setSessionFactory(SessionFactory sessionFactory) {
		this.sessionFactory = sessionFactory;
	}
	public Session getSession(){
		
		return sessionFactory.getCurrentSession();
	}
	public void addFb(Feedback feedback) {
		// TODO Auto-generated method stub
		getSession().save(feedback);
	}

	public void delFb(Feedback feedback) {
		// TODO Auto-generated method stub
		getSession().delete(feedback);
	}

	public List<Feedback> selectFb() {
		// TODO Auto-generated method stub
		return null;
	}

	public Feedback selectFbById(int fbId) {
		// TODO Auto-generated method stub
		
		return (Feedback)getSession().load(Feedback.class, fbId);
	}

	public void upFb(Feedback feedback) {
		// TODO Auto-generated method stub
		getSession().update(feedback);
	}

}
